package com.owc.common.converter;

import com.owc.common.tool.DateUtils;
import com.owc.common.tool.ReflectionUtils;
import com.owc.filter.content.SecurityContextHolder;

import java.util.Date;

/**
 * @Author xiaom
 * @Date 2020/3/2 15:56
 * @Version 1.0.0
 * @Description <>
 **/
public interface Initialization<T> {

    /**
     * Initialization vo more basis data.
     */
    default void initBasisData(T t){
        ReflectionUtils.setFieldValue(t,"createTime", DateUtils.formatYMDHMS(new Date()));
        ReflectionUtils.setFieldValue(t,"createName", SecurityContextHolder.getCurrentUserName());
        ReflectionUtils.setFieldValue(t,"createId",SecurityContextHolder.getCurrentUserId());
    }
}
